//
//  BStudent.swift
//  ChapterAll
//
//  Created by Kevin on 2020/4/28.
//  Copyright © 2020 Kevin. All rights reserved.
//

import UIKit

class BStudent: NSObject,NSCoding,NSSecureCoding {
    
    static var supportsSecureCoding: Bool = true
    
    var age:Int = 0
    var name:String?
    
    override init() {
        super.init()
    }
    
    func encode(with coder: NSCoder) {
        coder.encode(age, forKey: "age")
        coder.encode(name, forKey: "name")
    }
    
    required init?(coder: NSCoder) {
        super.init()
        age = coder.decodeInteger(forKey: "age")
        name = coder.decodeObject(forKey: "name") as? String
    }
    
    override var description: String {
        return "age=\(age),name=\(String(describing: name))"
    }
}
